---
layout: "default"
title: "preconditionFailure"
description: "Swift documentation for 'preconditionFailure'"
root: "/v5.1"
keywords: ""
---

<div class="intro-declaration"><code class="language-swift">func preconditionFailure(_:file:line:)(_ message: @autoclosure () -> String = String(), file: StaticString = #file, line: UInt = #line) -> Never</code></div><div class="discussion comment"><p>Indicates that a precondition was violated.
</p>
<p>Use this function to stop the program when control flow can only reach the
call if your API was improperly used. This function's effects vary
depending on the build flag used:</p>
</div>